import { createMemoryHistory, createRouter, createWebHistory } from "vue-router";
import { isMobile } from "../utils/common";
import mobileRouters from './modules/mobile-routes'
import pcRoutes from './modules/pc-routes'

// console.log(import.meta.env)
const router = createRouter({
	history: import.meta.env.SSR ? createMemoryHistory() : createWebHistory(),
    routes:isMobile.value ? mobileRouters : pcRoutes,
    // scrollBehavior(to, from, savedPosition){
	// 	if(savedPosition){
	// 		return savedPosition;
	// 	}else{
	// 		return { left: 0, top: 0 };
	// 	}
    // }
})

export function createSSRRouter(){
	return router;
}